package edu.byu.intex2.data.bo;

import edu.byu.intex2.data.DataException;
import edu.byu.intex2.data.dao.CustomerDAO;
import java.util.List;

/**
 * Customer represents a customer of mag.  Keeps high and low price.
 * @author Brady
 */
public class Customer extends Person
{

    private double highPrice;
    private double lowPrice;
    private List<Sale> sales;

    /** Creates a new instance of BusinessObject */
    public Customer(String id)
    {
        super(id);
    }//constructor

    /**
     * @return the highPrice
     */
    public double getHighPrice()
    {
        return highPrice;
    }

    /**
     * @param highPrice the highPrice to set
     */
    public void setHighPrice(double highPrice)
    {
        this.highPrice = highPrice;
        this.setDirty();
    }

    /**
     * @return the lowPrice
     */
    public double getLowPrice()
    {
        return lowPrice;
    }

    /**
     * @param lowPrice the lowPrice to set
     */
    public void setLowPrice(double lowPrice)
    {
        this.lowPrice = lowPrice;
        this.setDirty();
    }

    /**
     * @return the sales
     */
    public List<Sale> getSales()
    {
        return sales;
    }

    /**
     * @param sales the sales to set
     */
    public void setSales(List<Sale> sales)
    {
        this.sales = sales;
        this.setDirty();
    }

    //Quick Access Method
    @Override
    public void save() throws DataException
    {
        try
        {
            CustomerDAO.getInstance().save(this);
        } catch (DataException e)
        {
            e.printStackTrace();
        }
    }
}
